package com.cq.ssm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cq.ssm.mapper.DutyMapper;
import com.cq.ssm.po.Duty;
import com.cq.ssm.service.DutyService;

@Component("dutyService")
public class DutyServiceImpl implements DutyService {

	@Autowired
	private DutyMapper dm;
	// 插入一条记录
	public boolean insertDuty(Duty d) throws Exception {
		int i = dm.insertSelective(d);
		return i==1?true:false;
	}

	// 根据id删除一条记录
	public boolean deleteById(Integer id) throws Exception {
		int i = dm.deleteByPrimaryKey(id);
		return i==1?true:false;
	}

	// 查询所有记录
	public List<Duty> findAll() throws Exception {
		return dm.selectAllDuty();
	}
}
